// pages/profit/profit.js 
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    pageNavIndex: '0',
    pageNav: ['直接收益明细', '裂变收益明细'],
    list: [],
    total:0,
    money1:0,
    money2:0,
    list1:[],
    list2:[],
  },
  chooseNav:function(e){
    var that = this;
    var index = e.currentTarget.dataset.index;
    that.setData({
      pageNavIndex:index
    })
    if(index == 0){
      that.setData({
        list: that.data.list1
      })
    } else if (index == 1) {
      that.setData({
        list: that.data.list2
      })
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  }, 

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    wx.request({
      url: app.siteInfo.shoppath +'sydetail',
      method:'post',
      data:{
        uid: app.siteInfo.uid,
        com_part_id: app.siteInfo.com_part_id,
      },
      success:function(res){
        that.setData({
          total: res.data.total,
          money1: res.data.money1,
          money2: res.data.money2,
          list: res.data.list1,
          list1: res.data.list1,
          list2: res.data.list2,
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  // onShareAppMessage: function () {

  // }
})